The present invention relates to an image compressing apparatus for performing data compression by an MH (modified Huffman) compression method.
A conventional image compressing apparatus which is designed to perform data compression by the MH compression method has a table of MH codes corresponding to the run lengths of black and white pixels so as to alternately code pixels of the respective colors in accordance with the colors and run lengths of the pixels.
In the above-described conventional image compressing apparatus, however, coding is performed upon measuring the run length of pixels. Therefore, measurement and coding are repeatedly performed with respect to a portion where frequent changes between black and white occur, resulting in a delay in processing.
Following is a brief description of MH compression.
In MH compression, an original image to be coded is a black/white binary image, and coding is performed from an upper portion to a lower portion of an image (in the sub-scanning direction) in units of scanning lines. A continuation of white pixels is defined as a white run; a continuation of black pixels, a black run; and the length of a run, a run length. Coding is performed by using variable-length MH codes corresponding to the run lengths of the runs of an original image.
A run having a run length of 63 or less is coded with a terminating code. A run having a run length of 64 or more is coded with a makeup code and a terminating code indicating the difference between the run length and the makeup code (a terminating code is also added if the difference is "0"). Coding of one line is performed from the left to the right (in the main scanning direction) and is started from a white run (a terminating code of white "0" is initially added to a line having a black pixel at the start position).
A code (000000000001) called an EOL is added to coded data at the end of coding of one line, and a code (six consecutive EOLs) called an RTC indicating a page end is added to coded data at the end of coding of all the lines, thus completing image compression of one page.